package flc.ast.adapter;

import android.graphics.Color;
import android.view.View;

import androidx.annotation.NonNull;
import androidx.recyclerview.widget.GridLayoutManager;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.listener.OnItemClickListener;
import com.chad.library.adapter.base.provider.BaseItemProvider;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;

import flc.ast.R;
import flc.ast.bean.MySignInRecordBean;
import stark.common.basic.adaptermutil.StkProviderMultiAdapter;
import stark.common.basic.adaptermutil.StkSingleSpanProvider;
import stark.common.basic.view.container.StkRecycleView;

public class SignInRecordAdapter extends StkProviderMultiAdapter<MySignInRecordBean> {

    public SignInRecordAdapter() {
        addItemProvider(new StkSingleSpanProvider<>(595));
        addItemProvider(new SignInRecordProvider());
    }

    private class SignInRecordProvider extends BaseItemProvider<MySignInRecordBean> {
        @Override
        public int getItemViewType() {
            return StkProviderMultiAdapter.TYPE_VIEW;
        }

        @Override
        public int getLayoutId() {
            return R.layout.item_sign_in_record;
        }

        @Override
        public void convert(@NonNull BaseViewHolder baseViewHolder, MySignInRecordBean bean) {
            baseViewHolder.setText(R.id.tvSignInRecordItemMonth, bean.getMoon());
            StkRecycleView recycleView = baseViewHolder.getView(R.id.rvSignInRecordItemList);
            recycleView.setLayoutManager(new GridLayoutManager(getContext(), 7));
            CalendarAdapter dayAdapter = new CalendarAdapter();
            recycleView.setAdapter(dayAdapter);
            dayAdapter.setList(bean.getListDay());
        }
    }

}
